import { unref } from 'vue'
import { useMessage } from '@/hooks/web/useMessage'
import { getAreaOptions } from '@/api/student_registe/common'

const { createMessage } = useMessage()

export const formatQuery = (data) => {
  let query = ''
  for (const index in data)
    if (data[index])
      query =
        `${query}` + data[index]
          ? `${query}search[${index}]=${encodeURIComponent(data[index])}&`
          : ''

  return query.slice(0, -1)
}

export const formatPhone = (data) => {
  if (!data) return ''
  return data.replace(/^(\d{3})\d{4}(\d{4})$/, '$1****$2')
}
